package com.code.user.service;

import com.code.user.model.AccountDO;
import com.baomidou.mybatisplus.extension.service.IService;
import org.springframework.http.ResponseEntity;
import org.springframework.security.oauth2.common.OAuth2AccessToken;
import org.springframework.web.HttpRequestMethodNotSupportedException;

import java.security.Principal;

/**
 * <p>
 * 账号表 服务类
 * </p>
 *
 * @author Yan
 * @since 2023-04-14
 */
public interface AccountService extends IService<AccountDO> {

    /**
     * 手机登录注册
     * @param principal
     * @return
     */
    ResponseEntity<OAuth2AccessToken> login(Principal principal) throws HttpRequestMethodNotSupportedException;

    /**
     * 根据用户名查找用户账号
     * @param username
     * @return 账号信息
     */
    AccountDO searchAccountByUsername(String username);

    /**
     * 注册账号
     * @param username 手机号
     */
    void registerAccount(String username);
}
